package com.example.demo;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@RestController
/*注解不是必须加在main方法所在的类，而是加在有注入从configServer取得的参数的类，我猜含义是重新注入*/
@RefreshScope
public class ConfigClientApplication {
			//http://localhost:8882/actuator/bus-refresh
	public static void main(String[] args) {
		SpringApplication.run(ConfigClientApplication.class, args);
	}

	@Value("${foo}")
	String  foo;

	@RequestMapping(value = "/hi")
	public String hi(){
		return foo;
	}
}
